package javacommon.base;

import cn.org.rapid_framework.util.DateConvertUtils;

/**
 * @author badqiu
 */
public abstract class BaseEntity implements java.io.Serializable
{
   public abstract Object getId();

   protected static final String DATE_FORMAT = "yyyy-MM-dd";

   protected static final String TIME_FORMAT = "HH:mm:ss";

   protected static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

   protected static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";

   public static String date2String(java.util.Date date, String dateFormat)
   {
      return DateConvertUtils.format(date, dateFormat);
   }

   public static <T extends java.util.Date> T string2Date(String dateString, String dateFormat, Class<T> targetResultType)
   {
      return DateConvertUtils.parse(dateString, dateFormat, targetResultType);
   }
}
